package org.eden.rpc.service.dao.blog;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.eden.rpc.common.entity.dao.Article;

import java.util.List;

public interface ArticleMapper {

    @Select("select * from article")
    List<Article> getArticles();

    @Insert("insert into article(title, summary, content, user_id, tag_id, state_id, read_count, `delete`, publish_time, update_time) " +
            "values(#{title}, #{summary}, #{content}, #{userId}, #{tagId}, #{stateId}, #{readCount}, #{delete}, #{publishTime}, #{updateTime})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insertArticle(Article article);

}
